﻿<!--***********************************************************************************

   Extended WPF Toolkit

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  **********************************************************************************-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
                    xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes"
                    xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../../Themes/Aero2/Common.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <conv:WizardPageButtonVisibilityConverter x:Key="WizardPageButtonVisibilityConverter" />

    <Style TargetType="{x:Type local:Wizard}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlNormalBorderKey}}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Grid />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Wizard}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}">
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <ContentPresenter Content="{Binding CurrentPage, RelativeSource={RelativeSource TemplatedParent}}" />

                            <Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,0" Padding="7">
                                <StackPanel>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Button Name="PART_HelpButton"
                                      Grid.Column="0"
                                      MinWidth="75" 
                                      Command="local:WizardCommands.Help" 
                                      Content="{TemplateBinding HelpButtonContent}">
                                            <Button.Visibility>
                                                <MultiBinding Converter="{StaticResource WizardPageButtonVisibilityConverter}">
                                                    <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HelpButtonVisibility" />
                                                    <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CurrentPage.HelpButtonVisibility" />
                                                </MultiBinding>
                                            </Button.Visibility>
                                        </Button>
                                        <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
                                            <Button Name="PART_CancelButton"
                                         Margin="0,0,7,0"
                                         MinWidth="75" 
                                         Command="local:WizardCommands.Cancel" 
                                         Content="{TemplateBinding CancelButtonContent}">
                                                <Button.Visibility>
                                                    <MultiBinding Converter="{StaticResource WizardPageButtonVisibilityConverter}">
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CancelButtonVisibility" />
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CurrentPage.CancelButtonVisibility" />
                                                    </MultiBinding>
                                                </Button.Visibility>
                                            </Button>
                                            <Button Name="PART_BackButton"
                                         MinWidth="75" 
                                         Command="local:WizardCommands.PreviousPage" 
                                         Content="{TemplateBinding BackButtonContent}">
                                                <Button.Visibility>
                                                    <MultiBinding Converter="{StaticResource WizardPageButtonVisibilityConverter}">
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="BackButtonVisibility" />
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CurrentPage.BackButtonVisibility" />
                                                    </MultiBinding>
                                                </Button.Visibility>
                                            </Button>
                                            <Button Name="PART_NextButton"
                                         MinWidth="75" 
                                         Command="local:WizardCommands.NextPage"
                                         Content="{TemplateBinding NextButtonContent}">
                                                <Button.Visibility>
                                                    <MultiBinding Converter="{StaticResource WizardPageButtonVisibilityConverter}">
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NextButtonVisibility" />
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CurrentPage.NextButtonVisibility" />
                                                    </MultiBinding>
                                                </Button.Visibility>
                                            </Button>
                                            <Button Name="PART_FinishButton"
                                         Margin="7,0,0,0"
                                         MinWidth="75" 
                                         Command="local:WizardCommands.Finish" 
                                         Content="{TemplateBinding FinishButtonContent}">
                                                <Button.Visibility>
                                                    <MultiBinding Converter="{StaticResource WizardPageButtonVisibilityConverter}">
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="FinishButtonVisibility" />
                                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="CurrentPage.FinishButtonVisibility" />
                                                    </MultiBinding>
                                                </Button.Visibility>
                                            </Button>
                                        </StackPanel>
                                    </Grid>
                                </StackPanel>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="BlankWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
        <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
            <Grid Background="{TemplateBinding Background}">
                <ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
            </Grid>
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="ExteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
        <Grid Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                <Grid Grid.Column="0" Background="{TemplateBinding ExteriorPanelBackground}" MinWidth="{Binding ExteriorPanelMinWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Wizard}}">
                    <ContentControl Content="{TemplateBinding ExteriorPanelContent}" />
                </Grid>
            </Border>
            <Grid Column="1" Margin="14">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" TextWrapping="Wrap" Margin="0,0,0,14" FontSize="16" FontWeight="Bold" Text="{TemplateBinding Title}" />
                <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="0,0,0,14" Text="{TemplateBinding Description}" />
                <ContentPresenter Grid.Row="2" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
            </Grid>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="InteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid Background="{TemplateBinding HeaderBackground}" MinHeight="56">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <StackPanel>
                    <TextBlock Margin="16,9,0,1" TextWrapping="Wrap" FontWeight="Bold" Text="{TemplateBinding Title}" />
                    <TextBlock Margin="32,0,0,3" TextWrapping="Wrap" Text="{TemplateBinding Description}" />
                </StackPanel>
                <Image Grid.Column="1" Margin="4" Source="{TemplateBinding HeaderImage}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>

            <Border Grid.Row="1" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                <Grid Background="{TemplateBinding Background}">
                    <ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
                </Grid>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type local:WizardPage}">
        <Style.Triggers>
            <Trigger Property="PageType" Value="Blank">
                <Setter Property="Background" Value="{StaticResource PanelBackgroundBrush}" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="Template" Value="{StaticResource BlankWizardPageTemplate}" />
            </Trigger>
            <Trigger Property="PageType" Value="Exterior">
                <Setter Property="Background" Value="White" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="ExteriorPanelBackground" Value="{StaticResource PanelBackgroundBrush}" />
                <Setter Property="Template" Value="{StaticResource ExteriorWizardPageTemplate}" />
            </Trigger>
            <Trigger Property="PageType" Value="Interior">
                <Setter Property="Background" Value="{StaticResource PanelBackgroundBrush}" />
                <Setter Property="BorderBrush" Value="{x:Static SystemColors.ActiveBorderBrush}" />
                <Setter Property="BorderThickness" Value="0,1,0,0" />
                <Setter Property="HeaderBackground" Value="White" />
                <Setter Property="Template" Value="{StaticResource InteriorWizardPageTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>
